import $api from '.';



// 添加报名

export const addBm = async (data) => {
  const res = await $api.post('/bm', {
    ...data,
  });

  return res;
};

// 修改报名信息
export const editBm = async (id, data) => {
  const res = await $api.patch(`/bm/${id}`, {
    ...data,
  });
  return res;
};

// 删除
export const delBm = async (id) => {
  const res = await $api.delete(`/bm/${id}`);
  return res;
};

// 查一个
export const getBm = async (id) => {
  const res = await $api.get(`/bm/${id}`);
  return res;
};

// 获取列表
export const getBmList = async ({ keyword, $limit = 10, $page = 1 }) => {
  const $skip = ($page - 1) * $limit;
  let queryStr = '';
  if (keyword) queryStr += `&name=${keyword}`;

  const res = await $api.get(`/bm?$limit=${$limit}&$skip=${$skip}${queryStr}`);
  return res;
};

export default {};
